[counter]

	Counter version 1.0b1 -- Created by Johan Slve johan@montania.se
	2001-07-26
	
	Put this tag on any Lasso page and it will show the number of times 
	that page has been accessed. The counter will increment once each time 
	the tag is used.
	If an error occurs it will show in the server log window. 
	Put the tag within [html_comment]to only show the counter in the page source. 
	
	Replace filetagsusername and filetagspassword with real username/password
	from your Lasso Security. 
	
	The counter is stored in a file named #<filename> in the same directory as the
	file that cntains the counter, for example #test.lasso.

	Usage examples:
	[counter]
	
	[HTML_Comment] [counter] [/HTML_Comment]
		

#MACRO_BEGIN
[Lasso_Comment]
[inline: -clientusername='filetagsusername', 
	-clientpassword='filetagspassword', 
	-nothing]
	
	[File_Control]
		[var_set: 'response_filename'=(String_GetField: EncodeNone, 
					(Response_FilePath), FieldNumber=(String_CountFields: (Response_FilePath), 
						delimiter='/'), 
					delimiter='/')]
		[var_set: 'directory_path'=(String_RemoveTrailing: (Response_FilePath), 
				Pattern=(var: 'response_filename', EncodeNone))]
		[var_set: 'counterfilename'=(string_concatenate: EncodeNone, 
			(var: 'directory_path', EncodeNone), 
			'#',
			(var: 'response_filename', EncodeNone))]
		[if: (File_Exists:(var: 'counterfilename'))]
		[else]
			[File_Create:(var: 'counterfilename')]
			[File_Write:(var: 'counterfilename'),'0',FileOverwrite]
		[/if]
		[Variable_Set:'counter'=(Math_Add:'1',
			(File_Read:(Var:'counterfilename'),
				FileStartPos='0',FileEndPos='10'))]
		[File_Write:(var: 'counterfilename'), (Variable:'counter'), FileOverwrite]
		[If: File_CurrentError != Error_NoError]
[Log: window]***   Macro 'counter':   [File_CurrentError] [var: 'counterfilename']
[/Log]
		[/If]
	[/File_Control]
[/inline]

[/Lasso_Comment][Var:'counter']
#MACRO_END
